//错题考试
import Http from "../../utils/HttpUtil";
import URL from "../URL";
export default{
    

    
    //随机考试
    async  RandomTest(){
        let url=URL.GetURL(URL.ExaminationRandomTest);
        return await(Http.Get(url))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },

    //顺序考试
    async  OrederTest(orderTestNumber){
        let url=URL.GetURL(URL.ExaminationOrederTest);
        return await(Http.Get(url+`?orderTestNumber=${orderTestNumber}`))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },
    // //查询课件目录章节列表
    // async  WrongExam(userId){
    //     let url=URL.GetURL(URL.ExaminationWrongExam);
    //     return await(Http.Get(url+"?userId="+userId))
    //     .then(response=>{
    //         return(response);
    //     },reject=>{
    //         return Promise.reject(reject);
    //     });
    // },

    //错题考试
    async  WrongExam(userId){
        let url=URL.GetURL(URL.WrongExam);
        return await(Http.Get(url+"?userId="+userId))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },

    //顺序考试列表
    async  OrederTestList(){
        let url=URL.GetURL(URL.ExaminationOrederTestList);
        return await(Http.Get(url))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },

    //错题库
    async  WrongTest(userId,page){
        let url=URL.GetURL(URL.ExaminationwrongTest);
        return await(Http.Get(url))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },

    //题目详情
    //type            类型 0驾驶员题库 1口试指南
    //questionId      目录id
    //questionNumber  题号 从1开始
    async  SelectQuestionChapterNumberDetails(type, questionId, questionNumber){
        let url=URL.GetURL(URL.QuestionSelectQuestionChapterNumberDetails+`?type=${type}&questionId=${questionId}&questionNumber=${questionNumber}`);
        return await(Http.Get(url))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },

    //交卷
    async  SubmitPaper(userId,grade, time, title, wrongTest){
        let url=URL.GetURL(URL.ExaminationSubmitPaper);
        let para={
            userId,grade, time, title, wrongTest
        }
        // console.log(para)
        return await(Http.Post(url,para))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },

    // //查询课件目录列表
    // async  WrongSubmitPaper(userId,grade,time,title,correct){
    //     let url=URL.GetURL(URL.ExaminationWrongSubmitPaper);
    //     var para={userId,grade,time,title,correct};
    //     return await(Http.Post(url,para))
    //     .then(response=>{
    //         return(response);
    //     },reject=>{
    //         return Promise.reject(reject);
    //     });
    // },


    //错题考试提交
    //userId     用户ID
    //grade      考试分数
    //time       考试时间 PS:yyyy-MM-dd HH:mm:ss
    //title      考试标题:错题考试
    //correct    正确列表 数组:直接传题目ID
    async  WrongSubmitPaper(userId,grade, time, title, correct){
        let url=URL.GetURL(URL.ExaminationWrongSubmitPaper);
        let para={
            userId,grade, time, title, correct
        }
        return await(Http.Post(url,para))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },

    //查询成绩
    async  SelectResultsByUser(userId,page){
        let url=URL.GetURL(URL.ExaminationSelectResultsByUser);
        return await(Http.Get(url+`?userId=${userId}&page=${page}`))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },
}